import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}

export function getList(querys) {
  return request({
    url: '/admin/listAdmin',
    method: 'get',
    params: querys
  })
}

export function delAdmin(id) {
  return request({
    url: '/admin/delAdmin/' + id,
    method: 'get'
  })
}

export function getAdminById(id) {
  return request({
    url: '/admin/getAdminById/' + id,
    method: 'get'
  })
}

export function saveAdmin(admin) {
  return request({
    url: '/admin/saveAdmin',
    method: 'post',
    data: admin
  })
}
